<?php 
class ControllerInformationvideo extends Controller {
	public function index() {  
		$this->language->load('information/video');

		$this->load->model('catalog/information');

		$this->data['breadcrumbs'] = array();

		$this->data['breadcrumbs'][] = array(
			'text'      => $this->language->get('text_home'),
			'href'      => $this->url->link('common/home'),
			'separator' => false
		);
		
		$this->data['breadcrumbs'][] = array(
				'text'      => $this->language->get('text_title'),
				'href'      => $this->url->link('information/video'),      		
				'separator' => $this->language->get('text_separator')
			);
		
		$this->document->setTitle('SportShop.bg : '.$this->language->get('text_title'));
		$this->data['button_readmore'] = $this->language->get('button_readmore');
		$this->data['heading_title'] = $this->language->get('text_title');
			
			if (isset($this->request->get['page'])) {
				$page = $this->request->get['page'];
			} else { 
				$page = 1;
			}	
		

			$this->data['videos'] = array();

			$data = array(
				'start'              => ($page - 1) * 20,
				'limit'              => 20
			);

			$video_total = $this->model_catalog_information->getTotalvideo(); 

			$results = $this->model_catalog_information->getvideo($data['limit'],$data['start']);

			foreach ($results as $result) {
				
				$this->data['videos'][] = array(
					'title' => $result['title'],
					'video' => $result['video'],
					
					'href'  => $this->url->link('information/information', 'information_id=' . $result['information_id'])
				);
			}
			

			$url = '';

			if (isset($this->request->get['filter'])) {
				$url .= '&filter=' . $this->request->get['filter'];
			}

			if (isset($this->request->get['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}

			
			$url = '';

			if (isset($this->request->get['filter'])) {
				$url .= '&filter=' . $this->request->get['filter'];
			}

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}	

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			
			$url = '';

			if (isset($this->request->get['filter'])) {
				$url .= '&filter=' . $this->request->get['filter'];
			}

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}	

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}
			$url .= '&limit=20';
			

			$pagination = new Pagination();
			$pagination->total = $video_total;
			$pagination->page = $page;
			$pagination->limit = 20;
			$pagination->text = $this->language->get('text_pagination');
			$pagination->url = $this->url->link('information/video',  $url . '&page={page}');

			$this->data['pagination'] = $pagination->render();

			

			
			if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/information/video.tpl')) {
				$this->template = $this->config->get('config_template') . '/template/information/video.tpl';
			} else {
				$this->template = 'default/template/information/video.tpl';
			}

			$this->children = array(
				'common/column_left',
				'common/column_right',
				'common/content_top',
				'common/content_bottom',
				'common/footer',
				'common/header'
			);

			$this->response->setOutput($this->render());
		
		
	}


}
?>